<template>
  <div>
    <fun-head></fun-head>
    <router-view></router-view>
    <login></login>
  </div>
</template>

<script type="text/ecmascript-6">
  import funHead from './components/head/head.vue'
  import { mapGetters } from 'vuex'
  import { IS_SHOW_LOGIN_WINDOW } from './store/mutation-types'
  import login from './components/login/login.vue'
  export default{
    computed: mapGetters({
      showLoginWindow: IS_SHOW_LOGIN_WINDOW
    }),
    components: {
      funHead,
      login
    },
    watch: {
      'showLoginWindow' (newValue, oldValue) {
        if (this.showLoginWindow === true) {
          this.$store.dispatch(IS_SHOW_LOGIN_WINDOW, true) // 如果登陆成功，设置成已登录状态
        }
      }
    }
  }
</script>
